<?php

class Landlord extends AppModel {
    var $useTable = false;
    var $_schema = array(
        'name'		=>array('type'=>'string', 'length'=>100), 
        'email'		=>array('type'=>'string', 'length'=>255),
        'confirm_email' => array('type' => 'string', 'length' => 255),
        'mobile'	=>array('type'=>'string', 'length'=>255),
        'content'	=>array('type'=>'text')
    );
    var $validate = array(
        'name' => array(
            'rule'=>array('minLength', 1), 
            'message'=>'Name is required' ),
        'email' => array(
            'rule'=>'email', 
            'message'=>'Must be a valid email address' ),
        'confirm_email' => array(
            'identicalFieldValues' => array(
                'rule' => array('identicalFieldValues'),
                'message' => 'email & confirm email do not match'
            )
        )
    );
    
    function identicalFieldValues($params) {
        if ($this->data['Landlord']['email'] != $this->data['Landlord']['confirm_email']) {
            return false;
        }
        return true;
    }

}